package cn.handwrit.springframework.support;

import cn.handwrit.springframework.BeansException;
import cn.handwrit.springframework.config.BeanDefinition;

import java.lang.reflect.Constructor;

public class CglibSubclassingInstantiationStrategy implements InstantiationStrategy {
    @Override
    public Object instantiation(BeanDefinition beanDefinition, String beanName, Constructor ctor, Object[] age) throws BeansException {
        //注意这里使用的Cglib 实例化
//        Enhancer enhancer = new Enhancer();
//        enhancer.setSuperclass(beanDefinition.getBeanClass());
//        enhancer.setCallback(new NoOp() {
//            @Override
//            public int hashCode() {
//                return super.hashCode();
//            }
//        });
//        if (null == ctor) return enhancer.create();
//        return enhancer.create(ctor.getParameterTypes(), args);
        return null;
    }
}
